var express = require('express');
var router = express.Router();

const connection = require('./conn');

connection.connect(()=>{
  console.log('数据库连接成功!')
})


router.post('/checklogin',(req,res)=>{
  let {username,password} = req.body;
  const sqlStr = `select * from users where name='${username}' and password='${password}'`;
  connection.query(sqlStr,(err,data)=>{
    if(err){
      throw err;
    }else{
      console.log(data);
      res.send(data);

    }
  })


  console.log(username,password);

})
module.exports = router;
